package com.cbank.service;

import com.cbank.dao.ModuleShowDetailDao;
import com.cbank.domain.ModuleShowDetail;
import org.apache.ibatis.annotations.Param;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ModuleShowDetailService {
    Logger logger=Logger.getLogger(ModuleShowDetailService.class);

    @Autowired
    private ModuleShowDetailDao moduleShowDetailDao;

    public ModuleShowDetail getById(Integer id){
        return this.moduleShowDetailDao.getById(id);
    }

    public ModuleShowDetail getByViewId(String viewId){
        return this.moduleShowDetailDao.getByviewId(viewId);
    }

    public List<ModuleShowDetail> getListByModuleShowIdAndType(Integer moduleShowId,Integer type){
        return this.moduleShowDetailDao.getListByModuleShowIdAndType(moduleShowId,type);
    }

    public List<ModuleShowDetail> getAllListByModuleShowId(Integer moduleShowId){return this.moduleShowDetailDao.getAllListByModuleShowId(moduleShowId);}

    public void save(ModuleShowDetail moduleShowDetail){
        ModuleShowDetail detail=this.moduleShowDetailDao.getById(moduleShowDetail.getId());
        if (detail == null){
            this.moduleShowDetailDao.insert(moduleShowDetail);
        }else {
            this.moduleShowDetailDao.update(moduleShowDetail);
        }
    }

    public void updateStatus(Integer status,Integer moduleShowDetailId){
        this.moduleShowDetailDao.updateStatus(status,moduleShowDetailId);
    }

    public void updateModuleShowId(Integer moduleShowId,Integer moduleShowDetailId){
        this.moduleShowDetailDao.updateModuleShowId(moduleShowId,moduleShowDetailId);
    }
}
